package org.dylan.web.util;

import java.io.IOException;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;

/**
 * 页面响应工具类
 * 
 * @author dylan
 * 
 */
public class ResponseUtil {
	/**
	 * 
	 * @param pageContext
	 * @param script
	 */
	public static void writeScript(PageContext pageContext, String script) {
		try {
			JspWriter writer = pageContext.getOut();
			writer.write("<script type=\"text/javascript\" src=\"" + script
					+ "\"></script>");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 
	 * @param pageContext
	 * @param path
	 */
	public static void writeCSS(PageContext pageContext, String path) {
		try {
			JspWriter writer = pageContext.getOut();
			writer.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""
					+ path + "\"></script>");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
